//go:build !windows

package progressbar

import (
	"os"

	"golang.org/x/sys/unix"
)

func (p *Progressbar) getTerminalSize() int {
	ws, err := unix.IoctlGetWinsize(int(os.Stdout.Fd()), unix.TIOCGWINSZ)
	if err != nil {
		return _DEFAULT_TERMINAL_SIZE
	}

	return int(ws.Col)
}
